import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '产品名称',
    align: "center",
    dataIndex: 'name'
  },
  {
    title: '物料',
    align: "center",
    dataIndex: 'requiredMaterial_dictText'
  },
  {
    title: '工艺',
    align: "center",
    dataIndex: 'requiredCraft_dictText'
  },
  {
    title: '产品库存（L）',
    align: "center",
    dataIndex: 'stock'
  },
  {
    title: '保质期（月）',
    align: "center",
    dataIndex: 'expirationDate'
  },
  // {
  //   title: '库存规则',
  //   align: "center",
  //   dataIndex: 'stockUnit'
  // },
];

//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: "产品名称",
    field: 'name',
    component: 'Input',
    colProps: {span: 6},
  },
];

//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '产品名称',
    field: 'name',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入产品名称!'},
             ];
    },
  },
  {
    label: '物料',
    field: 'requiredMaterial',
    component: 'JSelectMultiple',
    componentProps:{
      dictCode: "camellia_mes_raw,name,id"
    },
  },
  {
    label: '工艺',
    field: 'requiredCraft',
    component: 'JSelectMultiple',
    componentProps:{
      dictCode: "camellia_mes_process_craft,craft_name,id"
    },
  },
  {
    label: '产品库存（L）',
    field: 'stock',
    component: 'InputNumber',
  },
  {
    label: '保质期（月）',
    field: 'expirationDate',
    component: 'InputNumber',
  },
  // {
  //   label: '库存规则',
  //   field: 'stockUnit',
  //   component: 'Input',
  // },
	// TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];
